home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 004.TubeTest.cpt / TubeTest.r < prev    next >
Text File  |  1988-08-01  |  12KB  |  333 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Macintosh Developer Technical Support
  4. #
  5. #    Simple Color QuickDraw Animation Sample Application
  6. #
  7. #    TubeTest
  8. #
  9. #    TubeTest.r    -    ResEdit Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    8/88
  15. #
  16. #    Components:    TubeTest.p            August 1, 1988
  17. #                TubeTest.c            August 1, 1988
  18. #                TubeTest.r            August 1, 1988
  19. #                PTubeTest.make        August 1, 1988
  20. #                CTubeTest.make        August 1, 1988
  21. #
  22. #    The TubeTest program is a simple demonstration of how to use the Palette 
  23. #    Manager in a color program.  It has a special color palette that is associated
  24. #    with the main window.  The colors are animated using the Palette Manager 
  25. #    to give a flowing tube effect.  The program is very simple, and the Palette
  26. #    Manager and drawing parts are put in separate subroutines to make it easier
  27. #    to figure out what is happening.
  28. #    
  29. #    The program is still a complete Macintosh application with a Main Event Loop,
  30. #    so there is the extra code to run the MEL.  
  31. #    
  32. #    There is a resource file that is necessary as well, to define the Menus, Window,
  33. #    Dialog, and Palette resources used in the program.  
  34. #
  35. #    See Sample and TESample for the general structure and MultiFinder techniques that
  36. #    we recommend that you use when building a new application.
  37. #
  38. ------------------------------------------------------------------------------*/
  39.  
  40. #include "Types.r"
  41.  
  42. /* These define's are used in the MENU resources to disable specific
  43.    menu items. */
  44. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  45. #define MenuItem1    0b00001
  46. #define MenuItem2    0b00010
  47. #define MenuItem3    0b00100
  48. #define MenuItem4    0b01000
  49. #define MenuItem5    0b10000
  50.  
  51.  
  52. resource 'MENU' (1000, "Apple", preload) {
  53.     1000, textMenuProc,
  54.     AllItems & ~MenuItem2,    /* Disable item #2 */
  55.     enabled, apple,
  56.     {
  57.         "About TubeTest…",
  58.             noicon, nokey, nomark, plain;
  59.         "-",
  60.             noicon, nokey, nomark, plain
  61.     }
  62. };
  63.  
  64. resource 'MENU' (1001, "File", preload) {
  65.     1001, textMenuProc,
  66.     AllItems & ~MenuItem2,    /* Disable item #2 */
  67.     enabled, "File",
  68.     {
  69.         "Totally Tubular",
  70.             noicon, nokey, nomark, plain;
  71.         "-",
  72.             noicon, nokey, nomark, plain;
  73.         "Quit",
  74.             noicon, "Q", nomark, plain
  75.     }
  76. };
  77.  
  78. resource 'MENU' (1002, "Edit", preload) {
  79.     1002, textMenuProc,
  80.     AllItems & ~MenuItem2,    /* Disable items #2 */
  81.     enabled, "Edit",
  82.      {
  83.         "Undo",
  84.             noicon, "Z", nomark, plain;
  85.         "-",
  86.             noicon, nokey, nomark, plain;
  87.         "Cut",
  88.             noicon, "X", nomark, plain;
  89.         "Copy",
  90.             noicon, "C", nomark, plain;
  91.         "Paste",
  92.             noicon, "V", nomark, plain;
  93.         "Clear",
  94.             noicon, nokey, nomark, plain
  95.     }
  96. };
  97.  
  98.  
  99. resource 'WIND' (1000, "Tubeland") {
  100.     {50, 10, 350, 610},
  101.     documentProc, visible, noGoAway, 0x0, "Tubeland"
  102. };
  103.  
  104.  
  105. resource 'DLOG' (1000, "About TubeTest…") {
  106.     {90, 50, 180, 460},
  107.     rDocProc, visible, noGoAway, 0x0, 1000, "TubeAbout"
  108. };
  109.  
  110.  
  111. resource 'DITL' (1000) {
  112.      {
  113. /* 1 */ {60, 167, 81, 244},
  114.         button {
  115.             enabled,
  116.             "OK"
  117.         };
  118. /* 2 */ {5, 10, 60, 400},                /* SourceLanguage Item */
  119.         staticText {
  120.             disabled,
  121.             "Another totally tubular example program from Bo3b Johnson.  "
  122.             "This one shows how to use the Palette Manager, and color animation.  "
  123.             "Version 1.0"
  124.         }
  125.     }
  126. };
  127.  
  128.  
  129. data 'pltt' (1000, preload) {
  130.     $"0098 0000 0000 0000 0000 0000 0000 0000"    /* 150 entries, plus B&W. (152 total) */
  131.  
  132.     $"FFFF FFFF FFFF 0000 0000 0000 0000 0000"    /* white as first guy. */
  133.     $"0000 0000 0000 0002 0000 0000 0000 0000"    /* black as next guy. */
  134.  
  135.     $"FFFF 0000 0000 0004 0000 0000 0000 0000"   /* 25 in first set, ramp up green. */
  136.     $"FFFF 0A40 0000 0004 0000 0000 0000 0000"
  137.     $"FFFF 1480 0000 0004 0000 0000 0000 0000"
  138.     $"FFFF 1EC0 0000 0004 0000 0000 0000 0000"
  139.     $"FFFF 2900 0000 0004 0000 0000 0000 0000"
  140.     $"FFFF 3340 0000 0004 0000 0000 0000 0000"
  141.     $"FFFF 3D80 0000 0004 0000 0000 0000 0000"
  142.     $"FFFF 47C0 0000 0004 0000 0000 0000 0000"
  143.     $"FFFF 5200 0000 0004 0000 0000 0000 0000"
  144.     $"FFFF 5C40 0000 0004 0000 0000 0000 0000"
  145.     $"FFFF 6680 0000 0004 0000 0000 0000 0000"
  146.     $"FFFF 70C0 0000 0004 0000 0000 0000 0000"
  147.     $"FFFF 7B00 0000 0004 0000 0000 0000 0000"
  148.     $"FFFF 8540 0000 0004 0000 0000 0000 0000"
  149.     $"FFFF 8F80 0000 0004 0000 0000 0000 0000"
  150.     $"FFFF 99C0 0000 0004 0000 0000 0000 0000"
  151.     $"FFFF A400 0000 0004 0000 0000 0000 0000"
  152.     $"FFFF AE40 0000 0004 0000 0000 0000 0000"
  153.     $"FFFF B880 0000 0004 0000 0000 0000 0000"
  154.     $"FFFF C2C0 0000 0004 0000 0000 0000 0000"
  155.     $"FFFF CD00 0000 0004 0000 0000 0000 0000"
  156.     $"FFFF D740 0000 0004 0000 0000 0000 0000"
  157.     $"FFFF E180 0000 0004 0000 0000 0000 0000"
  158.     $"FFFF EBC0 0000 0004 0000 0000 0000 0000"
  159.     $"FFFF F600 0000 0004 0000 0000 0000 0000"
  160.  
  161.     $"FFFF FFFF 0000 0004 0000 0000 0000 0000"   /* 2nd set is lowering red. */
  162.     $"F5C0 FFFF 0000 0004 0000 0000 0000 0000"
  163.     $"EB80 FFFF 0000 0004 0000 0000 0000 0000"
  164.     $"E140 FFFF 0000 0004 0000 0000 0000 0000"
  165.     $"D700 FFFF 0000 0004 0000 0000 0000 0000"
  166.     $"CCC0 FFFF 0000 0004 0000 0000 0000 0000"
  167.     $"C280 FFFF 0000 0004 0000 0000 0000 0000"
  168.     $"B840 FFFF 0000 0004 0000 0000 0000 0000"
  169.     $"AE00 FFFF 0000 0004 0000 0000 0000 0000"
  170.     $"A3C0 FFFF 0000 0004 0000 0000 0000 0000"
  171.     $"9980 FFFF 0000 0004 0000 0000 0000 0000"
  172.     $"8F40 FFFF 0000 0004 0000 0000 0000 0000"
  173.     $"8500 FFFF 0000 0004 0000 0000 0000 0000"
  174.     $"7AC0 FFFF 0000 0004 0000 0000 0000 0000"
  175.     $"7080 FFFF 0000 0004 0000 0000 0000 0000"
  176.     $"6640 FFFF 0000 0004 0000 0000 0000 0000"
  177.     $"5C00 FFFF 0000 0004 0000 0000 0000 0000"
  178.     $"51C0 FFFF 0000 0004 0000 0000 0000 0000"
  179.     $"4780 FFFF 0000 0004 0000 0000 0000 0000"
  180.     $"3D40 FFFF 0000 0004 0000 0000 0000 0000"
  181.     $"3300 FFFF 0000 0004 0000 0000 0000 0000"
  182.     $"28C0 FFFF 0000 0004 0000 0000 0000 0000"
  183.     $"1E80 FFFF 0000 0004 0000 0000 0000 0000"
  184.     $"1440 FFFF 0000 0004 0000 0000 0000 0000"
  185.     $"0A00 FFFF 0000 0004 0000 0000 0000 0000"
  186.  
  187.     $"0000 FFFF 0000 0004 0000 0000 0000 0000"   /* 3rd set is raising blue. */
  188.     $"0000 FFFF 0A40 0004 0000 0000 0000 0000"
  189.     $"0000 FFFF 1480 0004 0000 0000 0000 0000"
  190.     $"0000 FFFF 1EC0 0004 0000 0000 0000 0000"
  191.     $"0000 FFFF 2900 0004 0000 0000 0000 0000"
  192.     $"0000 FFFF 3340 0004 0000 0000 0000 0000"
  193.     $"0000 FFFF 3D80 0004 0000 0000 0000 0000"
  194.     $"0000 FFFF 47C0 0004 0000 0000 0000 0000"
  195.     $"0000 FFFF 5200 0004 0000 0000 0000 0000"
  196.     $"0000 FFFF 5C40 0004 0000 0000 0000 0000"
  197.     $"0000 FFFF 6680 0004 0000 0000 0000 0000"
  198.     $"0000 FFFF 70C0 0004 0000 0000 0000 0000"
  199.     $"0000 FFFF 7B00 0004 0000 0000 0000 0000"
  200.     $"0000 FFFF 8540 0004 0000 0000 0000 0000"
  201.     $"0000 FFFF 8F80 0004 0000 0000 0000 0000"
  202.     $"0000 FFFF 99C0 0004 0000 0000 0000 0000"
  203.     $"0000 FFFF A400 0004 0000 0000 0000 0000"
  204.     $"0000 FFFF AE40 0004 0000 0000 0000 0000"
  205.     $"0000 FFFF B880 0004 0000 0000 0000 0000"
  206.     $"0000 FFFF C2C0 0004 0000 0000 0000 0000"
  207.     $"0000 FFFF CD00 0004 0000 0000 0000 0000"
  208.     $"0000 FFFF D740 0004 0000 0000 0000 0000"
  209.     $"0000 FFFF E180 0004 0000 0000 0000 0000"
  210.     $"0000 FFFF EBC0 0004 0000 0000 0000 0000"
  211.     $"0000 FFFF F600 0004 0000 0000 0000 0000"
  212.  
  213.     $"0000 FFFF FFFF 0004 0000 0000 0000 0000"   /* 4th set is lowering green. */
  214.     $"0000 F5C0 FFFF 0004 0000 0000 0000 0000"
  215.     $"0000 EB80 FFFF 0004 0000 0000 0000 0000"
  216.     $"0000 E140 FFFF 0004 0000 0000 0000 0000"
  217.     $"0000 D700 FFFF 0004 0000 0000 0000 0000"
  218.     $"0000 CCC0 FFFF 0004 0000 0000 0000 0000"
  219.     $"0000 C280 FFFF 0004 0000 0000 0000 0000"
  220.     $"0000 B840 FFFF 0004 0000 0000 0000 0000"
  221.     $"0000 AE00 FFFF 0004 0000 0000 0000 0000"
  222.     $"0000 A3C0 FFFF 0004 0000 0000 0000 0000"
  223.     $"0000 9980 FFFF 0004 0000 0000 0000 0000"
  224.     $"0000 8F40 FFFF 0004 0000 0000 0000 0000"
  225.     $"0000 8500 FFFF 0004 0000 0000 0000 0000"
  226.     $"0000 7AC0 FFFF 0004 0000 0000 0000 0000"
  227.     $"0000 7080 FFFF 0004 0000 0000 0000 0000"
  228.     $"0000 6640 FFFF 0004 0000 0000 0000 0000"
  229.     $"0000 5C00 FFFF 0004 0000 0000 0000 0000"
  230.     $"0000 51C0 FFFF 0004 0000 0000 0000 0000"
  231.     $"0000 4780 FFFF 0004 0000 0000 0000 0000"
  232.     $"0000 3D40 FFFF 0004 0000 0000 0000 0000"
  233.     $"0000 3300 FFFF 0004 0000 0000 0000 0000"
  234.     $"0000 28C0 FFFF 0004 0000 0000 0000 0000"
  235.     $"0000 1E80 FFFF 0004 0000 0000 0000 0000"
  236.     $"0000 1440 FFFF 0004 0000 0000 0000 0000"
  237.     $"0000 0A00 FFFF 0004 0000 0000 0000 0000"
  238.  
  239.     $"0000 0000 FFFF 0004 0000 0000 0000 0000"   /* 5th set is raising red. */
  240.     $"0A40 0000 FFFF 0004 0000 0000 0000 0000"
  241.     $"1480 0000 FFFF 0004 0000 0000 0000 0000"
  242.     $"1EC0 0000 FFFF 0004 0000 0000 0000 0000"
  243.     $"2900 0000 FFFF 0004 0000 0000 0000 0000"
  244.     $"3340 0000 FFFF 0004 0000 0000 0000 0000"
  245.     $"3D80 0000 FFFF 0004 0000 0000 0000 0000"
  246.     $"47C0 0000 FFFF 0004 0000 0000 0000 0000"
  247.     $"5200 0000 FFFF 0004 0000 0000 0000 0000"
  248.     $"5C40 0000 FFFF 0004 0000 0000 0000 0000"
  249.     $"6680 0000 FFFF 0004 0000 0000 0000 0000"
  250.     $"70C0 0000 FFFF 0004 0000 0000 0000 0000"
  251.     $"7B00 0000 FFFF 0004 0000 0000 0000 0000"
  252.     $"8540 0000 FFFF 0004 0000 0000 0000 0000"
  253.     $"8F80 0000 FFFF 0004 0000 0000 0000 0000"
  254.     $"99C0 0000 FFFF 0004 0000 0000 0000 0000"
  255.     $"A400 0000 FFFF 0004 0000 0000 0000 0000"
  256.     $"AE40 0000 FFFF 0004 0000 0000 0000 0000"
  257.     $"B880 0000 FFFF 0004 0000 0000 0000 0000"
  258.     $"C2C0 0000 FFFF 0004 0000 0000 0000 0000"
  259.     $"CD00 0000 FFFF 0004 0000 0000 0000 0000"
  260.     $"D740 0000 FFFF 0004 0000 0000 0000 0000"
  261.     $"E180 0000 FFFF 0004 0000 0000 0000 0000"
  262.     $"EBC0 0000 FFFF 0004 0000 0000 0000 0000"
  263.     $"F600 0000 FFFF 0004 0000 0000 0000 0000"
  264.  
  265.     $"FFFF 0000 FFFF 0004 0000 0000 0000 0000"   /* 6th set is lowering blue. */
  266.     $"FFFF 0000 F5C0 0004 0000 0000 0000 0000"
  267.     $"FFFF 0000 EB80 0004 0000 0000 0000 0000"
  268.     $"FFFF 0000 E140 0004 0000 0000 0000 0000"
  269.     $"FFFF 0000 D700 0004 0000 0000 0000 0000"
  270.     $"FFFF 0000 CCC0 0004 0000 0000 0000 0000"
  271.     $"FFFF 0000 C280 0004 0000 0000 0000 0000"
  272.     $"FFFF 0000 B840 0004 0000 0000 0000 0000"
  273.     $"FFFF 0000 AE00 0004 0000 0000 0000 0000"
  274.     $"FFFF 0000 A3C0 0004 0000 0000 0000 0000"
  275.     $"FFFF 0000 9980 0004 0000 0000 0000 0000"
  276.     $"FFFF 0000 8F40 0004 0000 0000 0000 0000"
  277.     $"FFFF 0000 8500 0004 0000 0000 0000 0000"
  278.     $"FFFF 0000 7AC0 0004 0000 0000 0000 0000"
  279.     $"FFFF 0000 7080 0004 0000 0000 0000 0000"
  280.     $"FFFF 0000 6640 0004 0000 0000 0000 0000"
  281.     $"FFFF 0000 5C00 0004 0000 0000 0000 0000"
  282.     $"FFFF 0000 51C0 0004 0000 0000 0000 0000"
  283.     $"FFFF 0000 4780 0004 0000 0000 0000 0000"
  284.     $"FFFF 0000 3D40 0004 0000 0000 0000 0000"
  285.     $"FFFF 0000 3300 0004 0000 0000 0000 0000"
  286.     $"FFFF 0000 28C0 0004 0000 0000 0000 0000"
  287.     $"FFFF 0000 1E80 0004 0000 0000 0000 0000"
  288.     $"FFFF 0000 1440 0004 0000 0000 0000 0000"
  289.     $"FFFF 0000 0A00 0004 0000 0000 0000 0000"
  290.  
  291. /* End of table, all 150 real entries, and 2 for B&W. */
  292. };
  293.  
  294.  
  295. /* we put the latest SIZE template here so we can rez with MPW 2.0 */
  296.  
  297. type 'SIZE' {
  298.         boolean        dontSaveScreen,
  299.                     saveScreen;
  300.         boolean     ignoreSuspendResumeEvents,
  301.                     acceptSuspendResumeEvents;
  302.         boolean        enableOptionSwitch,
  303.                     disableOptionSwitch;
  304.         boolean        cannotBackground,
  305.                     canBackground;
  306.         boolean        notMultiFinderAware,
  307.                     multiFinderAware;
  308.         boolean        backgroundAndForeground,
  309.                     onlyBackground;
  310.         boolean        dontGetFrontClicks,
  311.                     getFrontClicks;
  312.         unsigned bitstring[9] = 0;
  313.         unsigned longint;    /* preferred memory size in bytes */
  314.         unsigned longint;    /* minimum memory size in bytes */
  315. };    /* ignore the warning caused by re-defining SIZE */
  316.  
  317.  
  318. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  319.  
  320. resource 'SIZE' (-1) {
  321.     saveScreen,
  322.     ignoreSuspendResumeEvents,
  323.     disableOptionSwitch,
  324.     cannotBackground,
  325.     NotMultiFinderAware,        /* this says we do our own activate/deactivate; don't fake us out */
  326.     backgroundAndForeground,    /* this is definitely note a background-only application! */
  327.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  328.     100 * 1024,                    /* we made this (preferred) size bigger than the other (minimum) size */
  329.                                 /* so you can have more text & scraps */
  330.     100 * 1024                    /* we looked at a heap dump while the program was running */
  331.                                 /* it was using about 27K; we added 13K for stack, text & scraps */
  332. };
  333.